package br.edu.univas.jobmanager.dao;


import javax.persistence.EntityManager;
import javax.persistence.Query;

import br.edu.univas.jobmanager.entity.Categoria;

public class CategoriaDAO extends GenericDAO<Categoria, Integer>{

	public CategoriaDAO() {
		super();
	}

	public CategoriaDAO(EntityManager entityManager) {
		super(entityManager);
	}
	public Categoria findByName(String name){
		String hql = "from Categoria c where c.nome = :nome";
		
		Query query = getEntityManager().createQuery(hql);
		query.setParameter("nome", name);
		return (Categoria) query.getSingleResult();
	}
	
	
}